/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f8f9fa;
  color: #333;
}

/* App container */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  width: 100vw;
  max-width: none;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.15);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.app-header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
  /* box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15); */
}

.sidebar-toggle:active {
  /* transform: scale(0.98); */
  border: none;
}

/* Main container */
.main-container {
  flex: 1;
  display: flex;
  height: calc(100vh - 80px); /* 减去头部高度 */
  position: relative;
}

/* Sidebar - Compact Version */
.sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
  height: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}


/* 侧边栏切换按钮 */
.sidebar-toggle-btn {
  position: absolute;
  left: 0px; /* 侧边栏宽度 */
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 40px;
  background: white;
  color: #667eea;
  border: none;
  border-radius: 0 30px 30px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  z-index: 10;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  padding: 0;
  margin: 0;
}

.sidebar-toggle-btn svg {
  display: block;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-toggle-btn:active {
  /* transform: translateY(-50%) scale(0.95); */
  border: none;
}

.sidebar-toggle-btn:focus{
  border: none;
  outline: none;
}

.sidebar-toggle-btn.collapsed {
  left: -2px;
}

.sidebar-header {
  padding: 1rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  min-height: 48px;
}



.sidebar-header h3 {
  color: #333;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

/* Accordion Styles - Compact Version */
.accordion-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.accordion-item {
  margin-bottom: 0.25rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
}

.accordion-header {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  min-height: 36px;
}

.accordion-header:hover {
  background-color: #f5f5f5;
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.accordion-title svg {
  flex-shrink: 0;
}

.accordion-icon {
  transition: transform 0.2s ease;
  color: #666;
  flex-shrink: 0;
}

.accordion-icon.expanded {
  transform: rotate(90deg);
}

.accordion-content {
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  padding: 0.25rem;
}

.accordion-content .template-item {
  display: block;
  width: 100%;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.15rem;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  color: #495057;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accordion-content .template-item:hover {
  background: #f0f0f0;
  border-color: #ccc;
  transform: translateX(1px);
}

.accordion-content .template-item:last-child {
  margin-bottom: 0;
}

.template-categories {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Removed old category selector styles - replaced with accordion */



.template-category {
  margin-bottom: 0.5rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  color: #495057;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-header:hover {
  background: #e9ecef;
  border-color: #dee2e6;
  transform: translateY(-1px);
}

.category-header svg {
  flex-shrink: 0;
}

.category-header span {
  flex: 1;
  text-align: left;
}

.category-templates {
  margin-top: 0.5rem;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.template-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  color: #495057;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.template-item:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  transform: translateX(2px);
}

.template-item:active {
  transform: translateX(0);
}

/* Actions section - Compact */
.actions {
  padding: 0.75rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}



/* Editor container */
.editor-container {
  flex: 1;
  display: flex;
  background: white;
  overflow: hidden;
  transition: margin-left 0.3s ease;
  height: 100%;
  position: relative;
}



/* Code section */
.code-section {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e0e0;
  background: #ffffff;
  height: 100%;
  position: relative;
}

/* Preview section */
.preview-section {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  height: 100%;
  position: relative;
}

/* Resize handle */
.resize-handle {
  width: 8px;
  background-color: #f0f0f0;
  cursor: col-resize;
  position: relative;
  transition: background-color 0.2s;
}

.resize-handle:hover {
  background-color: #d0d0d0;
}

.resize-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 30px;
  background-color: #ccc;
  border-radius: 1px;
}

.section-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h3 {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  margin-right: 0.5em;
}

.section-header h3 svg {
  margin-right: 0.5em;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #667eea;
}

.loading {
  color: #6c757d;
  font-size: 0.9rem;
}

/* Monaco Editor container */
.monaco-editor-container {
  flex: 1;
  height: 100% !important;
}

/* Fallback editor */
.fallback-editor {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.fallback-textarea {
  flex: 1;
  padding: 1.5rem;
  border: none;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  background: #ffffff;
  color: #333333;
  border-left: 4px solid #4CAF50;
}

.editor-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #667eea;
  font-size: 0.8rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: center;
}

/* Preview section */
.preview-section {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  height: 100%;
  position: relative;
}

.diagram-container {
  flex: 1;
  padding: 20px;
  overflow: auto;
  background: #ffffff;
  border-radius: 8px;
  margin: 0px;
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
  height: calc(100% - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-diagram {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  border-radius: 8px;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
  padding: 1rem;
}

.mermaid-diagram svg {
  max-width: 100%;
  height: auto;
  cursor: grab;
}

.mermaid-diagram svg:active {
  cursor: grabbing;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid #667eea;
  color: #667eea;
}

.btn-outline:hover {
  background: #667eea;
  color: white;
}

/* Error and loading states */
.error-message {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 6px;
  padding: 1rem;
  color: #c33;
  margin-bottom: 1rem;
}

.loading {
  color: #667eea;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid #667eea;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 图表提示文档模态框样式 */
.chart-docs-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.chart-docs-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.chart-docs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e1e5e9;
}

.chart-docs-header h2 {
  margin: 0;
  font-size: 20px;
  color: #2c3e50;
}

.close-button {
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.close-button:hover {
  background-color: #f8f9fa;
}

.chart-docs-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.chart-docs-section {
  margin-bottom: 24px;
}

.chart-docs-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  color: #2c3e50;
  border-bottom: 1px solid #e1e5e9;
  padding-bottom: 6px;
}

.chart-docs-section p {
  margin: 0 0 12px;
  line-height: 1.5;
  color: #495057;
}

.chart-docs-section ul {
  margin: 0;
  padding-left: 20px;
}

.chart-docs-section li {
  margin-bottom: 8px;
  line-height: 1.5;
  color: #495057;
}

.syntax-example,
.code-example {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 12px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  color: #495057;
}

.parameters-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.parameters-table th,
.parameters-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e1e5e9;
}

.parameters-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
}

.parameters-table tr:last-child td {
  border-bottom: none;
}

/* Responsive design */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 1rem;
  }
  
  .template-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .actions {
    flex-direction: row;
    margin-top: 0;
  }
  
  .editor-container {
    height: 60vh;
  }
  
  .app-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .chart-docs-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .chart-docs-header,
  .chart-docs-body {
    padding: 16px;
  }
  
  .parameters-table th,
  .parameters-table td {
    padding: 8px;
    font-size: 14px;
  }
}

/* 自定义工具提示样式 */
[title] {
  position: relative;
  cursor: help;
}

[title]:hover::before {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.35);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  will-change: transform, opacity;
}

[title]:hover::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #667eea;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: transform, opacity;
}

[title]:hover::before,
[title]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-14px);
}

/* 按钮的特殊工具提示样式 */
button[title]:hover::before,
.btn[title]:hover::before,
.control-btn[title]:hover::before,
.zoom-btn[title]:hover::before {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
  animation: tooltipFloat 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 侧边栏切换按钮的特殊位置 */
.sidebar-toggle-btn[title]:hover::before {
  left: 120%;
  transform: translateX(0) translateY(-50%);
  top: 50%;
  bottom: auto;
  animation: tooltipFloatRight 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sidebar-toggle-btn[title]:hover::after {
  left: 120%;
  transform: translateX(-8px) translateY(-50%);
  top: 50%;
  bottom: auto;
  border-left: 6px solid #667eea;
  border-right: none;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.sidebar-toggle-btn[title]:hover::before,
.sidebar-toggle-btn[title]:hover::after {
  transform: translateX(10px) translateY(-50%);
}

/* 右侧按钮的工具提示位置调整 */
.mini-map-toggle[title]:hover::before,
.close-button[title]:hover::before {
  right: 100%;
  left: auto;
  transform: translateX(-12px) translateY(-50%);
  top: 50%;
  bottom: auto;
  animation: tooltipFloatLeft 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mini-map-toggle[title]:hover::after,
.close-button[title]:hover::after {
  right: 100%;
  left: auto;
  transform: translateX(-6px) translateY(-50%);
  top: 50%;
  bottom: auto;
  border-right: 6px solid #667eea;
  border-left: none;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.mini-map-toggle[title]:hover::before,
.mini-map-toggle[title]:hover::after,
.close-button[title]:hover::before,
.close-button[title]:hover::after {
  transform: translateX(-16px) translateY(-50%);
}

/* 拖拽调整大小手柄的工具提示位置 - 右侧 */
.resize-handle[title]:hover::before {
  left: 100%;
  right: auto;
  transform: translateX(12px) translateY(-50%);
  top: 50%;
  bottom: auto;
  animation: tooltipFloatRight 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  will-change: transform, opacity;
}

.resize-handle[title]:hover::after {
  left: 100%;
  right: auto;
  transform: translateX(6px) translateY(-50%);
  top: 50%;
  bottom: auto;
  border-left: 6px solid #667eea;
  border-right: none;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.resize-handle[title]:hover::before,
.resize-handle[title]:hover::after {
  transform: translateX(16px) translateY(-50%);
}

/* 顶部按钮的工具提示位置调整 - 显示在下方 */
.section-actions button[title]:hover::before,
.section-actions .btn[title]:hover::before {
  top: 100%;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  animation: tooltipFloatDown 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  will-change: transform, opacity;
}

.section-actions button[title]:hover::after,
.section-actions .btn[title]:hover::after {
  top: 100%;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border-top: none;
  border-bottom: 6px solid #667eea;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.section-actions button[title]:hover::before,
.section-actions .btn[title]:hover::before {
  transform: translateX(-50%) translateY(12px);
}

.section-actions button[title]:hover::after,
.section-actions .btn[title]:hover::after {
  transform: translateX(-50%) translateY(2px);
}

/* 预览控制区域按钮的工具提示位置调整 */
.preview-controls button[title]:hover::before,
.preview-controls .control-btn[title]:hover::before,
.preview-controls .pattern-btn[title]:hover::before,
.color-picker-wrapper[title]:hover::before {
  top: auto;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  animation: tooltipFloat 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  will-change: transform, opacity;
}

.preview-controls button[title]:hover::after,
.preview-controls .control-btn[title]:hover::after,
.preview-controls .pattern-btn[title]:hover::after,
.color-picker-wrapper[title]:hover::after {
  top: auto;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  border-top: 6px solid #667eea;
  border-bottom: none;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.preview-controls button[title]:hover::before,
.preview-controls .control-btn[title]:hover::before,
.preview-controls .pattern-btn[title]:hover::before,
.color-picker-wrapper[title]:hover::before {
  transform: translateX(-50%) translateY(-14px);
}

.preview-controls button[title]:hover::after,
.preview-controls .control-btn[title]:hover::after,
.preview-controls .pattern-btn[title]:hover::after,
.color-picker-wrapper[title]:hover::after {
  transform: translateX(-50%) translateY(-8px);
}

/* 工具提示动画 */
@keyframes tooltipFloat {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.8);
  }
  50% {
    transform: translateX(-50%) translateY(-16px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(-14px) scale(1);
  }
}

@keyframes tooltipFloatSide {
  0% {
    opacity: 0;
    transform: translateX(0) translateY(-50%) scale(0.8);
  }
  50% {
    transform: translateX(6px) translateY(-50%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(10px) translateY(-50%) scale(1);
  }
}

@keyframes tooltipFloatRight {
  0% {
    opacity: 0;
    transform: translateX(8px) translateY(-50%) scale(0.8);
  }
  50% {
    transform: translateX(16px) translateY(-50%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(14px) translateY(-50%) scale(1);
  }
}

@keyframes tooltipFloatDown {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px) scale(0.8);
  }
  50% {
    transform: translateX(-50%) translateY(16px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(14px) scale(1);
  }
}

@keyframes tooltipFloatLeft {
  0% {
    opacity: 0;
    transform: translateX(-8px) translateY(-50%) scale(0.8);
  }
  50% {
    transform: translateX(-16px) translateY(-50%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(-14px) translateY(-50%) scale(1);
  }
}

.sidebar-toggle-btn[title]:hover::before {
  animation: tooltipFloatSide 0.3s ease-out;
}

/* 深色主题下的工具提示 */
@media (prefers-color-scheme: dark) {
  [title]:hover::before {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: #e2e8f0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
  
  [title]:hover::after {
    border-top-color: #4a5568;
  }
  
  button[title]:hover::before,
  .btn[title]:hover::before,
  .control-btn[title]:hover::before,
  .zoom-btn[title]:hover::before {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
  }
  
  /* 拖拽调整大小手柄在深色主题下的特殊样式 */
  .resize-handle[title]:hover::before {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .resize-handle[title]:hover::after {
    border-left-color: #4a5568;
  }
  
  /* 顶部按钮在深色主题下的特殊样式 */
  .section-actions button[title]:hover::before,
  .section-actions .btn[title]:hover::before {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .section-actions button[title]:hover::after,
  .section-actions .btn[title]:hover::after {
    border-bottom-color: #4a5568;
  }
  
  /* 右侧按钮在深色主题下的特殊样式 */
  .mini-map-toggle[title]:hover::before,
  .close-button[title]:hover::before {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .mini-map-toggle[title]:hover::after,
  .close-button[title]:hover::after {
    border-right-color: #4a5568;
  }
  
  /* 侧边栏切换按钮在深色主题下的特殊样式 */
  .sidebar-toggle-btn[title]:hover::before {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .sidebar-toggle-btn[title]:hover::after {
    border-left-color: #4a5568;
  }
  
  /* 预览控制区域按钮在深色主题下的特殊样式 */
  .preview-controls button[title]:hover::before,
  .preview-controls .control-btn[title]:hover::before,
  .preview-controls .pattern-btn[title]:hover::before {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .preview-controls button[title]:hover::after,
  .preview-controls .control-btn[title]:hover::after,
  .preview-controls .pattern-btn[title]:hover::after {
    border-top-color: #4a5568;
  }
}

/* 特殊按钮的禁用状态 */
button[disabled][title]:hover::before,
.zoom-btn[disabled][title]:hover::before {
  background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
  box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
  [title]:hover::before {
    font-size: 11px;
    padding: 6px 8px;
  }
}

/* Navigation styles */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
  transition: transform 0.3s ease;
}

.nav-logo:hover {
  transform: translateY(-2px);
}

.nav-logo svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.nav-link.active {
  color: white;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 1px;
}

/* Mobile navigation styles */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .nav-link span {
    display: none;
  }
  
  .nav-link svg {
    margin: 0;
  }
}

/* Main content area */
.main-content {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.main-content:not(.home-page) {
  padding-top: 70px; /* Account for fixed navigation height on non-home pages */
}

/* Fallback editor styles */
.fallback-editor {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.fallback-textarea {
  flex: 1;
  width: 100%;
  padding: 1rem;
  border: none;
  background-color: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.fallback-textarea::placeholder {
  color: #6c6c6c;
}

.fallback-editor .editor-loading {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(102, 126, 234, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  backdrop-filter: blur(5px);
}

.editor-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #667eea;
  font-size: 0.8rem;
  font-weight: 500;
}

.editor-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid #667eea;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Mermaid diagram specific styles */
.mermaid-diagram .node rect,
.mermaid-diagram .node circle,
.mermaid-diagram .node ellipse,
.mermaid-diagram .node polygon {
  stroke-width: 2px;
}

.mermaid-diagram .edgePath .path {
  stroke-width: 2px;
}

.mermaid-diagram .edgeLabel {
  background-color: white;
  border-radius: 4px;
  padding: 2px 4px;
}

/* 预览控制区域样式 */
.preview-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  z-index: 10;
}

/* 缩放按钮样式 */
.zoom-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* 主题选择器样式 */
.theme-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.custom-theme-btn {
  background-color: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.custom-theme-btn:hover {
  background-color: #5a67d8;
}

.custom-theme-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.control-label {
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}

.theme-select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  font-size: 0.8rem;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  height: 28px;
}

.theme-select:hover {
  border-color: #ccc;
  background: #f9f9f9;
}

.theme-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0px;
  border-radius: 32px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.zoom-btn:hover {
  background: var(--primary-light, #818cf8);
  color: white;
  border-color: var(--primary-light, #818cf8);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zoom-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.zoom-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  stroke: #3b82f6; /* 蓝色 */
}

.zoom-btn:hover svg {
  transform: scale(1.1);
}

.zoom-btn:hover svg {
  stroke: #ffffff; /* 悬停时变为白色 */
}

.zoom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.zoom-btn:disabled:hover {
  background: var(--surface-color, #ffffff);
  color: var(--text-primary, #333333);
  border-color: var(--border-color, #e1e4e8);
  transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.zoom-btn:disabled:hover svg {
  transform: none;
}

/* 颜色选择器 */
.color-preview-wrapper {
  position: relative;
}

.color-picker-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 32px;
  overflow: hidden;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.color-picker-wrapper:hover {
  background: #f0f0f0;
  border-color: #ccc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-picker-wrapper:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.color-picker {
  position: absolute;
  width: 100%;
  height: 100%;
  border: none;
  cursor: pointer;
  opacity: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 0;
}

/* 背景图案控制 */
.pattern-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pattern-btn {
  width: 32px;
  height: 32px;
  padding: 0px;
  border: 1px solid #ddd;
  border-radius: 32px;
  overflow: hidden;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pattern-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pattern-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pattern-btn.active {
  border-color: #667eea;
  background: #f0f4ff;
}

.pattern-preview {
  width: 100%;
  height: 100%;
  border-radius: 2px;
}

/* 背景图案预览样式 */
.none-preview {
  background: white;
}

/* 自定义主题模态框 */
.custom-theme-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.custom-theme-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.custom-theme-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.custom-theme-header h2 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
}

.custom-theme-body {
  padding: 20px;
}

.color-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.color-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.color-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.color-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-input {
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.color-text-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: monospace;
}

.color-text-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.custom-theme-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: #667eea;
  color: white;
}

.btn-primary:hover {
  background-color: #5a67d8;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.theme-preview {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
}

.theme-preview h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.1rem;
}

.preview-diagram {
  padding: 20px;
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
}

.preview-node {
  padding: 10px 20px;
  border-radius: 6px;
  border: 2px solid;
  font-weight: 500;
  text-align: center;
  min-width: 80px;
}

.preview-node-secondary {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  text-align: center;
  min-width: 80px;
}

.preview-line {
  position: absolute;
  height: 2px;
  width: 60px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* 深色模式下的自定义主题模态框 */
@media (prefers-color-scheme: dark) {
  .custom-theme-content {
    background: #1a1a1a;
    color: #e0e0e0;
  }
  
  .custom-theme-header {
    border-bottom-color: #333;
  }
  
  .custom-theme-header h2 {
    color: #e0e0e0;
  }
  
  .color-input {
    border-color: #444;
  }
  
  .color-text-input {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
  
  .custom-theme-actions {
    border-top-color: #333;
  }
  
  .theme-preview {
    background: #2a2a2a;
  }
  
  .theme-preview h3 {
    color: #e0e0e0;
  }
}

.dots-preview {
  background-image: radial-gradient(circle, #ddd 1px, transparent 1px);
  background-size: 8px 8px;
}

.lines-preview {
  background-image: repeating-linear-gradient(45deg, #ddd, #ddd 1px, transparent 1px, transparent 8px);
}

.grid-preview {
  background-image: 
    linear-gradient(to right, #ddd 1px, transparent 1px),
    linear-gradient(to bottom, #ddd 1px, transparent 1px);
  background-size: 8px 8px;
}

/* 背景图案样式 */
.diagram-container {
  position: relative;
  overflow: hidden;
}

.diagram-container.bg-pattern-dots {
  background-image: radial-gradient(circle, #0000001a 1px, transparent 1px);
  background-size: 20px 20px;
}

.diagram-container.bg-pattern-lines {
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(190, 186, 186, 0.05) 10px,
    rgba(163, 159, 159, 0.05) 11px
  );
  background-size: auto;
}

.diagram-container.bg-pattern-grid {
  background-image: 
    repeating-linear-gradient(0deg, #0000001a 0px, transparent 1px, transparent 20px, #0000001a 21px),
    repeating-linear-gradient(90deg, #0000001a 0px, transparent 1px, transparent 20px, #0000001a 21px);
  background-size: 21px 21px;
}

/* 深色主题下的背景图案 */
@media (prefers-color-scheme: dark) {
  .diagram-container.bg-pattern-dots {
    background-image: radial-gradient(circle, #ffffff1a 1px, transparent 1px);
  }
  
  .diagram-container.bg-pattern-lines {
    background-image: repeating-linear-gradient(0deg, #ffffff1a 0px, transparent 1px, transparent 20px, #ffffff1a 21px);
  }
  
  .diagram-container.bg-pattern-grid {
    background-image: 
      repeating-linear-gradient(0deg, #ffffff1a 0px, transparent 1px, transparent 20px, #ffffff1a 21px),
      repeating-linear-gradient(90deg, #ffffff1a 0px, transparent 1px, transparent 20px, #ffffff1a 21px);
  }
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
  .preview-controls {
    background: rgba(30, 30, 30, 0.9);
  }
  
  .control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .control-btn:active {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .pattern-btn {
    border-color: #444;
    background: #333;
  }
  
  .pattern-btn.active {
    border-color: #667eea;
    background: #2a2a4a;
  }
  
  .dots-preview {
    background-image: radial-gradient(circle, #555 1px, transparent 1px);
  }
  
  .lines-preview {
    background-image: repeating-linear-gradient(45deg, #555, #555 1px, transparent 1px, transparent 8px);
  }
  
  .grid-preview {
    background-image: 
      linear-gradient(to right, #555 1px, transparent 1px),
      linear-gradient(to bottom, #555 1px, transparent 1px);
  }
}

/* 导览小窗样式 */
.mini-map {
  position: absolute;
  top: 0px;
  right: 20px;
  width: 200px;
  height: 150px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 100;
}

.mini-map-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.mini-map-viewport {
  position: absolute;
  border: 2px solid #667eea;
  background: rgba(102, 126, 234, 0.1);
  cursor: move;
  z-index: 10;
}

.mini-map-viewport::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.mini-map-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  transition: all 0.2s ease;
}

.mini-map-toggle:hover {
  background: #f8f9fa;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 深色主题下的导览小窗 */
@media (prefers-color-scheme: dark) {
  .mini-map {
    background: #2a2a2a;
    border-color: #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  .mini-map-toggle {
    background: #333;
    border-color: #444;
    color: #ddd;
  }
  
  .mini-map-toggle:hover {
    background: #3a3a3a;
  }
  
  .preview-controls button[title]:hover::before,
  .preview-controls .control-btn[title]:hover::before,
  .preview-controls .pattern-btn[title]:hover::before,
  .color-picker-wrapper[title]:hover::before {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .preview-controls button[title]:hover::after,
  .preview-controls .control-btn[title]:hover::after,
  .preview-controls .pattern-btn[title]:hover::after,
  .color-picker-wrapper[title]:hover::after {
    border-top: 6px solid #667eea;
  }
}

/* Tooltip测试页面样式 */
.tooltip-test-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.tooltip-test-container h2 {
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.tooltip-test-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tooltip-test-section h3 {
  color: #667eea;
  margin-bottom: 15px;
  border-bottom: 2px solid #667eea;
  padding-bottom: 5px;
}

.tooltip-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.tooltip-demo-item {
  text-align: center;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #f9f9f9;
}

.tooltip-demo-item .demo-button {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.tooltip-demo-item .demo-button:hover {
  background: #5a6fd8;
}

.tooltip-demo-item .demo-button.secondary {
  background: #6c757d;
}

.tooltip-demo-item .demo-button.secondary:hover {
  background: #5a6268;
}

.tooltip-demo-item .demo-button.success {
  background: #28a745;
}

.tooltip-demo-item .demo-button.success:hover {
  background: #218838;
}

.tooltip-demo-item .demo-button.warning {
  background: #ffc107;
  color: #212529;
}

.tooltip-demo-item .demo-button.warning:hover {
  background: #e0a800;
}

.tooltip-demo-item .demo-button.info {
  background: #17a2b8;
}

.tooltip-demo-item .demo-button.info:hover {
  background: #138496;
}

.tooltip-demo-item .demo-button.dark {
  background: #343a40;
}

.tooltip-demo-item .demo-button.dark:hover {
  background: #23272b;
}

/* 深色主题下的Tooltip测试页面 */
@media (prefers-color-scheme: dark) {
  .tooltip-test-container h2 {
    color: #fff;
  }
  
  .tooltip-test-section {
    background: #2a2a2a;
    border-color: #444;
  }
  
  .tooltip-test-section h3 {
    color: #8a9df5;
    border-bottom-color: #8a9df5;
  }
  
  .tooltip-demo-item {
    border-color: #444;
    background: #333;
  }
  
  .tooltip-demo-item .demo-button:hover {
    opacity: 0.9;
  }
}
